package com.toolbox.controller.infra;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.toolbox.dto.InfraLogLoginDTO;
import com.toolbox.pages.Pager;
import com.toolbox.result.ResponseResultDTO;
import com.toolbox.service.InfraLogLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 登录日志表 前端控制器
 * </p>
 *
 * @author Mango
 * @since 2023-12-01
 */
@SuppressWarnings("ALL")
@ApiSort(100)
@Api(tags = "登录日志表 前端控制器")
@RestController
@RequestMapping("/log-login-do")
public class InfraLogLoginController {

    @Autowired
    private InfraLogLoginService service;

    /**
     * 获取——登录日志（分页）
     *
     * @param pageIndex 当前页
     * @param pageSize  每页条数
     * @return 集合
     */
    @ApiOperationSupport(order = 100)
    @ApiOperation(value = "获取——登录日志（分页）")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageIndex", value = "当前页", example = "1", required = false, dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", example = "10", required = false, dataTypeClass = Integer.class)
    })
    @GetMapping(value = "/get-login-log-page")
    public ResponseResultDTO<Pager<InfraLogLoginDTO>> getLoginLogPage(@RequestParam(name = "pageIndex", defaultValue = "1") Integer pageIndex,
                                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        return ResponseResultDTO.success(service.getLoginLogPage(pageIndex, pageSize));
    }

}
